#include <iostream>
#include <string>
bool isRelation-name(string s)
{
	if(isIdentifier(s))
		return true;
	else
		return false;
}
bool isIdentifier(string s)
{
	for(int i=0;i<s.size();i++)
	{
		if(!isalpha(s[i]) || !isdigit(s[i]))
			return false
	}
	return true;
}
/*bool isAlpha(char a)
{
	if(isalpha(a))
		return true;
	else
		return false;
}
bool isDigit(string)
{ad
}*/

bool isExpr(string s)
{
	if(isSelection(s) || isAtomic-expr(s) || isProjection(s) || isRenaming(s) || isUnion(s) || isDifference(s) || isProduct(s))
		return true;
	else 
		return false;
}
/*bool isAtomic-expr(string s)
{
	size_t loc0=0,loc1;
	string divider (" | "), temp_string;
	bool flag=true;

	loc1=s.find(divider);
	if(loc1==string::npos)
	{
		return isRelation-name(s);
	}
	else
	{
		temp_string=s.substr(loc0, loc1-loc0);
		if(isRelation-name(temp_string))
		{
			loc0=loc1+3;
			loc1=s.find(divider,loc0+1)
			while(loc1!=string::npos)
			{
				temp_string=s.substr(loc0, loc1-loc0);
				if(temp_string.

				loc=s.find(divider, loc+1);
			}
		}
		else
			return false
	}

}*/


bool isAtomic-expr(string s)
{
	return (isRelation-name(s) || isExpr(s.substr(1,s.size()-2)))
}

bool isSelection(string s)
{
	string temp_string;
	size_t loc0=0, loc1=0;
	loc1=find(" ) ");
	if(loc1==string::npos)
		return false;

	if(s.substr(0,9) == "select ( " || == "SELECT ( " 
		&& isCondition(s.substr(9,loc1-9)) 
		&& isAtomic-expr(s.substr(loc1+3,s.size()-loc1-2)))
		return true;
}

bool isCondition(string s)
{
	return isConjunction(s);
}

bool isConjunction(string s)
{
	return isComparison(s);
}

bool isComparison(string s)
{
	
}

bool isOp(string s)
{
	if(s=="==" || s=="!=" || s=="<" || s==">" || s=="<=" || s==">=")
		return true;
	else 
		return false;
}

bool isOperand(string s)
{
	if(isAttribute-name(s) || isLiteral(s))
		return true;
	else
		return false;
}

bool isAttribute-name(string s)
{
	
}